import http from '../../util/request.js';
//获取应用实例
var app = getApp();
Page({
    data: {
        userInfo : {},
        OrderStatus:'',
        statOrder:[],
        showModal: true,
    },

    onLoad: function () {
        var info = wx.getStorageSync('userInfo');
        console.log(info);
        if (info.wxInfo) {
          this.setData({
            userInfo: info.wxInfo,
            showModal: false,
          });
        }else{
          showModal: true
        }
    },
    onShow: function () {
    },

    memberInfo:function(){
       var that = this;
       if (that.data.userInfo.fail==-1){
          wx.showToast({
              title: '请先登录',
              icon: 'success',
              duration: 2000
          })
       }else{
          wx.navigateTo({
              url: '../memberInfo/memberInfo',
          })
       }
    },

    favorite: function () {
      var that = this;
      if (that.data.userInfo.fail == -1) {
        wx.showToast({
          title: '请先登录',
          icon: 'success',
          duration: 2000
        })
      } else {
        wx.navigateTo({
          url: '../favorite/favorite',
        })
     }
    },

    //获取用户信息新接口
    agreeGetUser: function (e) {
      var that = this
      var app = getApp()
      app.util.getUserInfo(function (userInfo) {
        //这回userInfo为用户信息
        console.log(userInfo)
        that.setData({
          userInfo: userInfo.wxInfo,
          showModal: false
        });
      });
    },
    navigator: function (e) {
      wx.switchTab({
        url: e.currentTarget.dataset.url,
      })
    },






    /**
 * 弹窗
 */
    showDialogBtn: function () {
      this.setData({
        showModal: true
      })
    },
    /**
     * 弹出框蒙层截断touchmove事件
     */
    preventTouchMove: function () {
    },
    /**
     * 隐藏模态对话框
     */
    hideModal: function () {
      this.setData({
        showModal: false
      });
    },
    /**
     * 对话框取消按钮点击事件
     */
    onCancel: function () {
      this.hideModal();
    },

});
